<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ page import="net.sapfree.core.util.DateUtility"%>

<%@ taglib uri="/WEB-INF/sapfree-info.tld" prefix="sap" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String capitaluuid = (String)request.getAttribute("capitaluuid");
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<meta http-equiv="keywords" content="login,regist first">
<meta http-equiv="description" content="This is login page">
<meta http-equiv="X-UA-Compatible" content="IE=7">

<title>我的飞客</title>
<link href="<%=path%>/include/styleBase/css/fontStyle.css" rel="stylesheet"></link>
<link href="<%=path%>/include/styleBase/css/formStyle.css" rel="stylesheet"></link>
<link href="<%=path%>/include/DatePicker/skin/formStyle.css" rel="stylesheet"></link>

<script type="text/javascript" src="<%=path%>/include/js/jquery.js"></script>
<script type="text/javascript" src="<%=path%>/include/js/style.js"></script>
<script type="text/javascript" src="<%=path%>/include/DatePicker/WdatePicker.js"></script>
 
<script type="text/javascript" src="<%=path%>/include/KindEditor/kindeditor.js"></script>


<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style>
<script>


function saveCapital(){
	//alert(window.parent.document.frm.action);
	content = KE.util.getPureData("editorContent")
	htmlcontent = KE.html("editorContent");
	
	document.getElementById("CONTENT").value=content;
	document.getElementById("HTMLCONTENT").value=htmlcontent;
	
	document.frm.action="<%=path%>/wiki?method=createCapital";
	document.frm.submit();
}


function getArticleTitle(){
	return $("#ARTICLE_AI_TITLE").val();
}

function getArticlePublishTime(){
	return '<%=DateUtility.getCurrentDate()%>'+$("#curtime").val();
}




function preViewBlog(){
	window.open("<%=path%>/jsp/article/preViewBlog.jsp");
}


$(document).ready(function(){
    //富文本编辑器
    KE.show({
		id : 'editorContent',
		resizeMode : 1,
		allowUpload : true,
		imageUploadJson : '<%=path%>/servlet/FileUploadManagerServlet?method=saveImageOfArticle',
		afterCreate : function(id) {},
		filterMode : true,
		
		items : ["source","|","fullscreen","undo","redo","print","cut","copy","paste","plainpaste",
"wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","|","selectall","-","title","fontname","fontsize","|","textcolor","bgcolor","bold","italic","underline","strikethrough","removeformat","|","image","flash","media","advtable","hr","emoticons","link","unlink","|","about"]
	});
	
});


function _showVote(){
	if(document.frm.ISVOTE.checked){
		$("#votearea").show();
	}else{
		$("#votearea").hide();
	}
}

var optcount=5;
function addvoteOpt(){
	
	var optHtml='<div><span style=\"width:80px;text-align:right;\">选项'+optcount+'</span>'+
				'  <input type=\"text\" name=\"OPTIONTITLE\" style=\"font-size:18px; width:400px;\"></div>';
	$("#voteOptSpan").append(optHtml);
	optcount=optcount+1;
}
			
</script>

</head>
<body style="text-align:center;">


<form name="frm" method="post">

<input style="display:none;" type="text" id="CONTENT" name="CONTENT" value=""/>                  
<input style="display:none;" type="text" id="HTMLCONTENT" name="HTMLCONTENT" value=""/>
<input type="hidden" id="CAPITALUUID" name="CAPITALUUID" value="<%=capitaluuid%>" />

<sap:WordCapital id="<%=capitaluuid%>">

<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
    	<td align="center">
      	<table border="0" cellpadding="0" cellspacing="0" width="1000">
          <tr>
            <td class="tdTitle" nowrap align="right">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
              <td class="tdTitle" nowrap width="120" align="right">
                  标题：              </td>
              <td width="880">
                  <input class="inputTxt" type="text" id="CAP_WKC_NAME" name="CAP_WKC_NAME" style="width:300px;" value="<sap:write property='WKC_NAME'/>"/>              </td>
          </tr>
          <tr>
            <td align="center" colspan="2" height="10"></td>
          </tr>
          <tr>
          	<td align="center" colspan="2">
            <textarea class=""  id ="editorContent" name="editorContent" minlength="20" required error="正文内容不能为空或过于简洁！" label="申请正文" style="width:800px;height:495px;visibility:hidden;word-wrap:break-word;word-break:break-all;" ><sap:write property="WKC_CONTENTHTML"/></textarea>            </td>
          </tr>
      </table>

</sap:WordCapital>

<div style="margin-top:20px;">
  
</div>

	</td>
</tr>
</table>

<table border="0" cellpadding="0" cellspacing="0" width="310" style="margin-top:20px;" align="center">
	<tr>
    	<td width="70">
        <table border="0" cellpadding="0" cellspacing="0" width="60" height="25">
            <tr>
              <td width="60" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;" onClick="saveCapital();">发布</span></td>
            </tr>
        </table>
        </td>
        <td width="70">
        <table border="0" cellpadding="0" cellspacing="0" width="60" height="25">
            <tr>
              <td width="60" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;" onClick="preViewBlog();">预览</span></td>
            </tr>
        </table>
        </td>
        <td width="170">
        <table border="0" cellpadding="0" cellspacing="0" width="120" height="25">
            <tr>
              <td width="120" bgcolor="f6891f" align="center" style="cursor:hand;"><span style="color:#FFFFFF; font-weight:bold; font-size:14px;">保存到草稿箱</span></td>
            </tr>
        </table>
        </td>
    </tr>
</table>

</form>
</body>
</html>